Skip to content

fix(integration): preserve ai_skills on use for skills-mode Copilot#3551

Merged
mnriem merged 1 commit into
github:mainfrom
mnriem:mnriem-fix-3550-use-preserves-skills-mode
Jul 15, 2026
Merged

fix(integration): preserve ai_skills on use for skills-mode Copilot#3551
mnriem merged 1 commit into
github:mainfrom
mnriem:mnriem-fix-3550-use-preserves-skills-mode

Conversation

@mnriem

@mnriem mnriem commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

Closes #3550

Problem

Running specify integration use copilot against a Copilot integration installed with --integration-options "--skills" silently dropped "ai_skills": true from .specify/init-options.json, even though .specify/integration.json still recorded parsed_options.skills: true. The two files then contradicted each other, and any skills-mode extension commands (e.g. git) were regenerated in the legacy .github/agents/*.agent.md + .github/prompts/*.prompt.md layout, coexisting with the existing .github/skills/speckit-*/SKILL.md files.

Reproduced exactly against current main:

$ specify init proj --integration copilot --integration-options "--skills" --script sh --ignore-agent-tools
$ cd proj && specify extension add git
$ specify integration use copilot
# ai_skills removed from init-options.json; git commands duplicated in agents/ + prompts/

Root cause

_update_init_options_for_integration (src/specify_cli/integrations/_helpers.py) decided ai_skills purely from isinstance(integration, SkillsIntegration) or the instance's _skills_mode flag. Copilot is not a SkillsIntegration; its skills mode lives in parsed_options["skills"] and only sets _skills_mode during setup(). On the use path no setup() runs, so get_integration("copilot") returns an instance with _skills_mode == False, and the already-resolved parsed_options were never consulted — so ai_skills was popped. The downstream refresh then treated Copilot as non-skills and regenerated extension commands in the legacy layout.

Fix

  • _set_default_integration now passes its resolved parsed_options into _update_init_options_for_integration.
  • Skills mode is detected from SkillsIntegration or the instance _skills_mode or parsed_options["skills"] (consistent with how init and command_invocation_separator already detect it).

Testing

  • Added test_use_preserves_copilot_skills_mode, which follows the issue's exact sequence and asserts ai_skills survives and no legacy-layout files are produced. It resets the registry singleton's _skills_mode to faithfully simulate a fresh process — in-process test invocations otherwise reuse the singleton left in skills mode by init, which masks the bug. Verified the test fails without the fix and passes with it.
  • tests/integrations/test_integration_subcommand.py, test_integration_copilot.py, and test_integration_base_skills.py all pass (162 tests).

This PR was authored by GitHub Copilot (model: Claude Opus 4.8) on behalf of @mnriem.

…github#3550)

`specify integration use copilot` against a Copilot install configured with
`--integration-options "--skills"` dropped `"ai_skills": true` from
init-options.json and regenerated extension commands in the legacy
`.agent.md`/`.prompt.md` layout, contradicting `integration.json`'s stored
`parsed_options.skills: true`.

`_update_init_options_for_integration` only inspected `SkillsIntegration` /
the instance `_skills_mode` flag. On the `use` path no `setup()` runs, so the
freshly-resolved Copilot instance has `_skills_mode == False` and the stored
skills intent in `parsed_options` was ignored. Thread the resolved
`parsed_options` through and treat `parsed_options["skills"]` as skills mode.

Adds a regression test that resets the registry singleton's `_skills_mode` to
simulate a fresh process (in-process singleton reuse otherwise masks the bug).

Assisted-by: GitHub Copilot (model: Claude Opus 4.8, autonomous)

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 06fb6ae9-f444-4dfd-ab3f-d0669c5d0604
Copilot AI review requested due to automatic review settings July 15, 2026 16:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a Copilot integration edge case where specify integration use copilot would incorrectly clear ai_skills in .specify/init-options.json for projects originally initialized with Copilot --skills, causing extensions to be regenerated into the legacy .github/agents/*.agent.md + .github/prompts/*.prompt.md layout alongside existing .github/skills/**/SKILL.md files.

Changes:

  • Preserve skills-mode detection during integration use by passing resolved parsed_options into _update_init_options_for_integration.
  • Teach _update_init_options_for_integration to detect skills mode via SkillsIntegration, instance _skills_mode, or parsed_options["skills"] (to cover Copilot’s skills mode on the use path).
  • Add a regression test that reproduces issue #3550’s exact sequence and asserts ai_skills is preserved and no legacy-layout files are regenerated.
Show a summary per file
File Description
src/specify_cli/integrations/_helpers.py Fixes ai_skills persistence by incorporating resolved parsed_options when updating init-options during integration use.
tests/integrations/test_integration_subcommand.py Adds an end-to-end regression test covering init --skillsextension addintegration use copilot without regressing into legacy command layout.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Low

@mnriem mnriem merged commit 2fb18c7 into github:main Jul 15, 2026
12 checks passed
@mnriem mnriem deleted the mnriem-fix-3550-use-preserves-skills-mode branch July 15, 2026 16:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: integration use drops ai_skills from init-options.json for a skills-mode Copilot install

2 participants